package com.gupao.springbootdemo.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;

@RestController
public class K8SController {

    private final static Logger logger = LoggerFactory.getLogger(K8SController.class);

    @RequestMapping("/k8s/{key}")
    public String k8s(@PathVariable("key") String key) throws Exception {
        logger.info("K8SController.k8s request param:key===>{}", key);
        InetAddress localhost = InetAddress.getLocalHost();
        logger.info("K8SController.k8s request param:key===>{} ,response value:{}", key, localhost);
        return String.format("hello K8s <br/>111222 3333 444 ,key:%s ,ip:%s  ", key, localhost);
    }

    @RequestMapping("/version")
    public String version() {
        return "Hello,i am v1.0";
    }

}
